<?php
$site_config = function_lib::site_config();
if (file_exists(Yii::app()->params['config']['updir']['member'] . Yii::app()->user->getState('member_image'))) {
    $member_image = Yii::app()->user->getState('member_image');
} else {
    $member_image = '_default.jpg';
}
$switch = vo_network::get_network_group(Yii::app()->user->getId()); 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>[Virtual Office] <?php echo $site_config['configuration_title']; ?></title>
        <meta name="description" content="<?php echo $site_config['configuration_meta_description']; ?>" />
        <meta name="keywords" content="<?php echo $site_config['configuration_meta_keyword']; ?>" />
        <link href="<?php echo Yii::app()->params['memberUrl']; ?>/css/std.css" rel="stylesheet" type="text/css" />
        <link href="<?php echo Yii::app()->params['memberUrl']; ?>/css/l.css" rel="stylesheet" type="text/css" />

        <script type="text/javascript" src="<?php echo Yii::app()->params['memberUrl']; ?>/js/zoom/zoom.js"></script>
        <link rel="stylesheet" href="<?php echo Yii::app()->params['memberUrl']; ?>/js/zoom/zoom.css" type="text/css" />
        <style>
            /*-----------------------------------CONFIRMATION----------------------------------------------------- */
            .titleError { margin:5px 0 0 0; padding:5px 10px; border:1px solid #f6dbdb; border-bottom:none; background:#f6dbdb; color:#dd0000; }
            .msgError { margin:0 0 10px 0; padding:5px 5px; border:1px solid #f6dbdb; background:#fcf7f7; color:#dd0000; font-size:9pt; }

            .titleSuccess { margin:5px 0 0 0; padding:5px 10px; border:1px solid #e3f5e3; border-bottom:none; background:#daefda; color:#248724; }
            .msgSuccess { margin:0 0 10px 0; padding:5px 5px; border:1px solid #daefda; background:#f9fdf9; color:#248724; font-size:9pt; }

            .titleInfo { margin:0 0 0 0; padding:5px 10px; border:1px solid #dae1ef; border-bottom:none; background:#dae1ef; color:#4b6fb8; }
            .msgInfo { margin:0 0 10px 0; padding:5px 5px; border:1px solid #dae1ef; background:#f2f5fc; color:#4b6fb8; font-size:9pt; }
        </style>
    </head>
    <body>
        <div class="body">
            <div class="top"></div>
            <div class="wrap">
                <div class="header">
                    <div class="logo"><a href="#"><img src="<?php echo Yii::app()->params['memberUrl']; ?>/images/logo.jpg" alt="logo" /></a></div>
                    <div class="hmiddle"></div>
                    <div class="hright">
                        <div class="hrighttop"></div>
                        <div class="hrighthome"><a href="<?php echo Yii::app()->baseUrl; ?>/member/main/dashboard"><img src="<?php echo Yii::app()->params['memberUrl']; ?>/images/home.jpg" alt="Home" /></a><a href="<?php echo Yii::app()->baseUrl; ?>/member/logout"><img src="<?php echo Yii::app()->params['memberUrl']; ?>/images/logout.jpg" alt="logout" /></a></div>
                        <div class="hrightbtm"></div>
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="spacer"></div>
                <div class="sdbar">
                    <div class="sidebarmenu-item">
                        <h3>INFO MEMBER </h3>
                        <div class="content">
                            <strong style="font-size:11px;">
                                Masa Aktif Kartu anda Sampai :

                                <?php
                                $thn = function_lib::get_member_activation(Yii::app()->user->getState('network_id'));
                                //echo $thn2;
                                //echo date($thn2,'d M Y');
                                echo "<font style='color:red'>" . date_format(date_create($thn), 'd M Y') . "</font>";
                                ?>
                            </strong>
                            <table width="100%" border="0">
                                <tr>
                                    <td width="50" rowspan="2"><img src="<?php echo Yii::app()->params['config']['dir']['member'] . Yii::app()->user->getState('member_image'); ?>" alt="<?php echo Yii::app()->user->getState('network_mid'); ?>" width="65" height="65" /></td>
                                    <td style="padding-top:7px; font-size:11px;">
                                        <strong><?php echo Yii::app()->user->getState('network_mid'); ?></strong><br />
                                        <strong><?php echo Yii::app()->user->getState('member_name'); ?></strong><br />
                                        <strong style="color: red; font-size:12px;"><?php echo function_lib::get_peringkat(Yii::app()->user->getState('network_id')); ?></strong><br />

                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" align="left" style="padding-top:0px; font-size:11px;">
                                        <form action="<?php echo Yii::app()->baseUrl; ?>/member/main/switch" method="post" name="member_form">
                                            <strong>Switch User:</strong><br />
                                            <select name="switch_id">
                                                <?php
                                                if ($switch != false) {
                                                    foreach ($switch as $row_network_group) {
                                                        $selected = ($row_network_group['network_mid'] == Yii::app()->user->getState('network_mid')) ? ' selected' : '';
                                                        echo '<option value="' . $row_network_group['network_mid'] . '"' . $selected . '>' . $row_network_group['network_mid'] . '</option>';
                                                    }
                                                }
                                                ?>
                                            </select>
                                            <input type="submit" name="switch" class="button" value=" Go " />
                                        </form>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <div class="btm"></div>
                    </div>
                    <?php
                    $menu_category = function_lib::uri_segment(2);
                    $active_url = function_lib::uri_segment(1) . '/' . function_lib::uri_segment(2) . '/' . function_lib::uri_segment(3);
                    $type_member = function_lib::get_type_member(Yii::app()->user->getState('network_id'));
                    ?>
                    <div class="sidebarmenu">
                        <div class="sidebarmenu-item">
                            <h3><a href="javascript:void(0);" onclick="toogleSubMenu('menu1', 8)">Menu Utama</a></h3>
                            <div class="sidebar-menu" id="menu1" style="display:<?php echo ($menu_category == 'main') ? 'block' : 'none'; ?>;">
                                <ul>
                                    <li<?php echo ($active_url == 'member/main/profile') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/main/profile">Ubah Profil</a></li>
                                    <li<?php echo ($active_url == 'member/main/password') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/main/password">Ubah Password</a></li>
                                    <li<?php echo ($active_url == 'member/main/testimony') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/main/testimony">Kirim Testimonial</a></li>
                                    <li<?php echo ($active_url == 'member/main/information') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/main/information">Informasi</a></li>
                                    <?php
                                    if (strtoupper($type_member) == "WHUM") {
                                        ?>    
                                        <li<?php echo ($active_url == 'member/main/sertifikat') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/main/sertifikat">Sertifikat Warehouse Umroh</a></li>

                                    <?php } ?>
                                    <?php
                                    if (strtoupper($type_member) == "WHQD") {
                                        ?>    
                                        <li<?php echo ($active_url == 'member/main/sertifikat_whqd') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/main/sertifikat_whqd">Sertifikat WHQD</a></li>

                                    <?php } ?>
                                </ul>
                            </div>
                            <div class="btm" id="menu1btm"></div>
                        </div>
                        <div class="sidebarmenu-item">
                            <h3><a href="javascript:void(0);" onclick="toogleSubMenu('menu2', 8)">Jaringan Binary</a></h3>
                            <div class="sidebar-menu" id="menu2" style="display:<?php echo ($menu_category == 'binary') ? 'block' : 'none'; ?>;">
                                <ul>
                                    <li<?php echo ($active_url == 'member/binary/geneology') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/binary/geneology">Geneologi Binary</a></li>
                                    <li<?php echo ($active_url == 'member/binary/sponsoring') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/binary/sponsoring">Sponsorisasi</a></li>
                                    <li<?php echo ($active_url == 'member/binary/report') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/binary/report">Report Jaringan</a></li>
                                    <li<?php echo ($active_url == 'member/binary/log_level_status') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/binary/log_level_status">Log Perkembangan Jaringan</a></li>
                                    <li<?php echo ($active_url == 'member/binary/reward') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/binary/reward">Report Reward</a></li>
                                    <li<?php echo ($active_url == 'member/binary/upgrade') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/binary/upgrade">Upgrade Membership</a></li>
                                </ul>
                            </div>
                            <div class="btm" id="menu2btm"></div>
                        </div>
                        <div class="sidebarmenu-item">
                            <h3><a href="javascript:void(0);" onclick="toogleSubMenu('menu3', 8)">Jaringan Global</a></h3>
                            <div class="sidebar-menu" id="menu3" style="display:<?php echo ($menu_category == 'matrix') ? 'block' : 'none'; ?>;">
                                <ul>
                                    <li<?php echo ($active_url == 'member/matrix/report') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/matrix/report">Report Level Jaringan</a></li>
                                </ul>
                            </div>
                            <div class="btm" id="menu3btm"></div>
                        </div>
                        <div class="sidebarmenu-item">
                            <h3><a href="javascript:void(0);" onclick="toogleSubMenu('menu4', 8)">Jaringan Board</a></h3>
                            <div class="sidebar-menu" id="menu4" style="display:<?php echo ($menu_category == 'board') ? 'block' : 'none'; ?>;">
                                <ul>
                                    <li<?php echo ($active_url == 'member/board/report') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/board/report">Report Jaringan</a></li>
                                    <li<?php echo ($active_url == 'member/board/roll') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/board/roll">Report Cycle</a></li>
                                </ul>
                            </div>
                            <div class="btm" id="menu4btm"></div>
                        </div>
                        <div class="sidebarmenu-item">
                            <h3><a href="javascript:void(0);" onclick="toogleSubMenu('menu5', 8)">Bonus</a></h3>
                            <div class="sidebar-menu" id="menu5" style="display:<?php echo ($menu_category == 'bonus') ? 'block' : 'none'; ?>;">
                                <ul>
                                    <li<?php echo ($active_url == 'member/bonus/summary') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/bonus/summary">Total Bonus</a></li>
                                    <li<?php echo ($active_url == 'member/bonus/log') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/bonus/log">Log Bonus</a></li>
                                    <li<?php echo ($active_url == 'member/bonus/prestasi_distributor') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/bonus/prestasi_distributor">Bonus Prestasi Distributor</a></li>
                                    <li<?php echo ($active_url == 'member/bonus/prestasi_warehouse') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/bonus/prestasi_warehouse">Bonus Prestasi Warehouse</a></li>
                                    <li<?php echo ($active_url == 'member/bonus/prestasi_factory') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/bonus/prestasi_factory">Bonus Prestasi Factory</a></li>
                                    <li<?php echo ($active_url == 'member/bonus/royalti_produk') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/bonus/royalti_produk">Bonus Royalti Produk</a></li>
                                    <li<?php echo ($active_url == 'member/bonus/royalti_angsuran') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/bonus/royalti_angsuran">Bonus Royalti Angsuran</a></li>
                                    <li<?php echo ($active_url == 'member/bonus/board_level') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/bonus/board_level">Bonus Level Board</a></li>
                                    <li<?php echo ($active_url == 'member/bonus/board_cycle') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/bonus/board_cycle">Bonus Cycle Board</a></li>
                                    <li<?php echo ($active_url == 'member/bonus/statement' || $active_url == 'member/bonus/statement_detail') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/bonus/statement">Statement Bonus</a></li>
                                    <li<?php echo ($active_url == 'member/bonus/omset' ) ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/bonus/omset">Omset Belanja</a></li>
                                </ul>
                            </div>
                            <div class="btm" id="menu5btm"></div>
                        </div>
                        <div class="sidebarmenu-item">
                            <h3><a href="javascript:void(0);" onclick="toogleSubMenu('menu6', 8)">E-Wallet</a></h3>
                            <div class="sidebar-menu" id="menu6" style="display:<?php echo ($menu_category == 'ewallet') ? 'block' : 'none'; ?>;">
                                <ul>
                                     <!--<li<?php echo ($active_url == 'member/ewallet/log') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/ewallet/log">Log E-Wallet</a></li>-->
                                    <li<?php echo ($active_url == 'member/ewallet/withdrawal') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/ewallet/withdrawal">Withdrawal E-Wallet</a></li>
                                    <li<?php echo ($active_url == 'member/ewallet/withdrawal') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/ewallet/transfer">Transfer E-Wallet</a></li>
                                    <li<?php echo ($active_url == 'member/ewallet/summary') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/ewallet/summary">Report E-Wallet</a></li>
                                    <li<?php echo ($active_url == 'member/ewallet/withdrawal_report') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/ewallet/logwithdraw">Report Withdrawal E-Wallet</a></li>
                                    <li<?php echo ($active_url == 'member/ewallet/topup') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/ewallet/topup">Top Up E-Wallet Cash</a></li>
                                </ul>
                            </div>
                            <div class="btm" id="menu6btm"></div>
                        </div>
                        <div class="sidebarmenu-item">
                            <h3><a href="javascript:void(0);" onclick="toogleSubMenu('menu7', 8)">E-Commerce</a></h3>
                            <div class="sidebar-menu" id="menu7" style="display:<?php echo ($menu_category == 'ecommerce') ? 'block' : 'none'; ?>;">
                                <ul>
                                    <li<?php echo ($active_url == 'member/ecommerce/upgrade') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/ecommerce/upgrade/list">Belanja Produk Upgrade</a></li>
                                    <li<?php echo ($active_url == 'member/ecommerce/auto') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/ecommerce/auto/list">Belanja Produk Belanja Bulanan</a></li>
                                    <li<?php echo ($active_url == 'member/ecommerce/voucher') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/ecommerce/voucher/list">Belanja Produk Voucher</a></li>
                                    <li<?php echo ($active_url == 'member/ecommerce/extra') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/ecommerce/extra/list">Belanja Produk Cycle</a></li>
                                    <li<?php echo ($active_url == 'member/ecommerce/log') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/ecommerce/log">Log Belanja Produk</a></li>
                                    <li<?php echo ($active_url == 'member/ecommerce/serial') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/ecommerce/serial">Log Pembelian Serial</a></li>
                                </ul>
                            </div>
                            <div class="btm" id="menu7btm"></div>
                        </div>
                        <div class="sidebarmenu-item">
                            <h3><a href="javascript:void(0);" onclick="toogleSubMenu('menu8', 8)">Online Payment</a></h3>
                            <div class="sidebar-menu" id="menu8" style="display:<?php echo ($menu_category == 'epayment') ? 'block' : 'none'; ?>;">
                                <ul>
                                    <li<?php echo ($active_url == 'member/epayment/pay') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/epayment/pay">Pembayaran</a></li>
                                    <li<?php echo ($active_url == 'member/epayment/log') ? ' class="active"' : ''; ?>><a href="<?php echo Yii::app()->baseUrl; ?>/member/epayment/log">Log Pembayaran</a></li>
                                </ul>
                            </div>
                            <div class="btm" id="menu8btm"></div>
                        </div>
                    </div>
                </div>
                <div class="main">
                    <div class="main-content">
                        <font>
                        <?php
                        $tanggalAsli = function_lib::get_member_activation(Yii::app()->user->getState('network_id'));
                        //$tanggalAsli = '2014-08-21';
//                        echo $tanggalAsli;
//                        echo"<br>";

                        $now = date('Y-m-d');

                        $tanggalExpired = date('Y-m-d', strtotime('-1 month', strtotime($tanggalAsli))); //operasi penjumlahan tanggal sebanyak 6 hari
                     
                        //$tanggalExpired = '2014-07-10'; //operasi penjumlahan tanggal sebanyak 6 hari
                        //$thn3 = date('m Y', strtotime($tgl2));
                        //$bulanasli = date('m Y', strtotime($thn));
                        //echo "ini bulan asli" . ' ' . $bulanasli;
//                        echo"<br>";
//                        echo $tanggalExpired;
//                        echo"<br>";
//                        echo $now;
//                        echo"<br>";
//                        echo $tanggalAsli;


                        if ($now < $tanggalExpired ) {
                            "";
                        } else if ($now == $tanggalExpired && $now < $tanggalAsli) {
                            echo '<div class="message-success">Masa Aktif anda Akan berakhir</div>';
                        } else if ($now > $tanggalExpired && $now > $tanggalAsli){
                            echo '<div class="message-success">Masa Aktif anda sudah berakhir</div>';
                        }

//                        
//                        $xx = $thn-$now;
//                        echo $xx;
//                        echo '</br>';
//                        if($xx == 0){
//                            echo 'masa berlaku anda sudah habis';
//                        } else {
//                            echo "masa berlaku anda akan habis pada"; 
//                        }
//                        echo $now;
//                        echo '</br>';
                        //echo $thn2;
                        ?>
                        </font>
                        <?php
                        if (Yii::app()->user->hasFlash('success')) {
                            echo '<div class="message-success">' . Yii::app()->user->getFlash('success') . '</div>';
                        } elseif (Yii::app()->user->hasFlash('error')) {
                            echo '<div class="message-error">' . Yii::app()->user->getFlash('error') . '</div>';
                        }
                        echo $content;
                        ?>
                    </div>
                </div>
                <div class="clear"></div>
            </div>
            <div class="mainbtm"></div>
            <div class="footer"><?php echo $site_config['configuration_footer']; ?></div>
        </div>
        <script type="text/javascript" src="<?php echo Yii::app()->params['memberUrl']; ?>/js/function.js"></script>
    </body>
</html>
